﻿Public Class frmEditaDepartamento
    Public vectore1(,) As String
    Public vectore1D(,) As String
    Dim capIDCargoDep As Integer
    Dim capIDdueñoDep As Integer

    Private Sub frmEditaDepartamento_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        completarDatosDpto()
        vectore1 = datosEditarCBPersona()
        For x = 0 To UBound(vectore1)
            cbPersona.SelectedIndex = x
            If idDepCargo = CInt(vectore1(cbPersona.SelectedIndex, 0)) Then

                cbPersona.SelectedValue = idDepCargo
                Exit For
            End If
        Next


        vectore1D = datosEditarCBPersonaDueño()
        For x = 0 To UBound(vectore1D)
            cbPersonaD.SelectedIndex = x
            If idDepDueño = CInt(vectore1D(cbPersonaD.SelectedIndex, 0)) Then

                cbPersonaD.SelectedValue = idDepDueño
                Exit For
            End If
        Next
        capIDCargoDep = CInt(vectore1(cbPersona.SelectedIndex, 0))
        capIDdueñoDep = CInt(vectore1D(cbPersonaD.SelectedIndex, 0))
    End Sub





    Private Sub btnModificar_Click(sender As Object, e As EventArgs) Handles btnModificar.Click
     
        Try

   
            actualizarDepartamento(datoDepatamento, txtActual.Text, txtAnterior.Text, idBlockDpto, capIDCargoDep, idGrupoDpto, txtRol.Text, txtNic.Text, txtNicAgua.Text, capIDdueñoDep)


        Catch ex As Exception
            mensajeError(ex)

        End Try

    End Sub

    Private Sub cbPersonaD_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbPersonaD.SelectedIndexChanged
        capIDdueñoDep = CInt(vectore1D(cbPersonaD.SelectedIndex, 0))

    End Sub

    Private Sub cbPersona_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbPersona.SelectedIndexChanged
        capIDCargoDep = CInt(vectore1(cbPersona.SelectedIndex, 0))
    End Sub
End Class